<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>高阶函数_函数柯里化</title>
  </head>

  <body>
    <div id="test"></div>

    <script type="text/javascript" src="../js/react.development.js"></script>
    <script
      type="text/javascript"
      src="../js/react-dom.development.js"
    ></script>
    <script type="text/javascript" src="../js/babel.min.js"></script>

    <script type="text/babel">
      class Login extends React.Component {

        state = {
          username:'',
          password:''
        }

        render() {
          return (
            <form action="http://www.atguigu.com" onSubmit={this.handleSubmit}>
              用户名:<input onChange={event => this.saveFormDte('username',event)} type="text" name="username"/>&nbsp;
              密码:<input onChange={event => this.saveFormDte('password',event)} type="password" name="password"/>&nbsp;
              <button>点击提示</button>&nbsp;
            </form>
          );
        }

        handleSubmit = event =>{
          event.preventDefault();
          alert(`你输入的用户名是:${this.state.username},你输入的密码是:${this.state.password}`)
        }

        saveFormDte = (dateType,event) =>{
            this.setState({[dateType]:event.target.value})
        }

      }

      ReactDOM.render(<Login />, document.getElementById("test"));
    </script>
  </body>
</html>
